
package com.timber.util;

import java.util.*;

//	currency rates are kept as base currency / some common counter ccy

public class SystemCodeMgr
{
  public static SLDataMgr mgr = new SLDataMgr( "com.db.gef.util.SystemCode", " select System, Descr from common..t_SystemCode " );
  public static SystemCode SELECT_ALL_SYSTEMS;

  static
  {
    SELECT_ALL_SYSTEMS = new SystemCode();
    SELECT_ALL_SYSTEMS.setSystem( SLDataMgr.SELECT_ALL );
    SELECT_ALL_SYSTEMS.setDescr( "Selects all system codes" );
  }

  public static void init()
  {
    try
    {
      mgr.init();
    }
    catch( Exception ex )
    {}
  }

  public static void init( String sSystem )
  {
    try
    {
      mgr.clear();
      mgr.addProcP( " where System = '" + sSystem + "'");
      mgr.runProc();

    }
    catch( Exception ex )
    {
      Util.error(ex);
    }
  }

  public static SystemCode getSystemCode( String sSystem )
  {
    return ( (SystemCode)mgr.getByKey( sSystem ) );
  }

  public static Vector getItems() throws Exception
  {
    return mgr.getKeyList();
  }

  public static Vector getDisplayItems() throws Exception
  {
    return mgr.getDisplayItems();
  }

  public static Vector getDataVector() throws Exception
  {
    return mgr.getDataVector();
  }

}
